package com.abbas.smartCity.ui.govservice;

import android.widget.ImageView;
import android.widget.TextView;

import com.abbas.smartCity.App;
import com.abbas.smartCity.R;
import com.abbas.smartCity.base.BaseActivity;
import com.abbas.smartCity.bean.gov.GovAppealBean;
import com.abbas.smartCity.retroft.ICallback;
import com.bumptech.glide.Glide;

import retrofit2.Call;

public class AppealDetailActivity extends BaseActivity {

    private ImageView im;
    private TextView titleTv;
    private TextView contentTv;
    private TextView otherTv;



    @Override
    protected int getLayoutId() {
        return R.layout.activity_appeal_detail;
    }

    @Override
    protected String setCustomTitle() {
        return "诉求详情";
    }

    @Override
    protected void initView() {
        im = (ImageView) findViewById(R.id.im);
        titleTv = (TextView) findViewById(R.id.title_tv);
        contentTv = (TextView) findViewById(R.id.content_tv);
        otherTv = (TextView) findViewById(R.id.other_tv);
    }

    @Override
    protected void initData() {
        final int id = getIntent().getIntExtra("id", -1);

        api.getAppealDetailOfId(id).enqueue(new ICallback<GovAppealBean>() {
            @Override
            public void onSuccess(Call<GovAppealBean> call, GovAppealBean data) {
                final GovAppealBean.DataBean data1 = data.getData();
                Glide.with(AppealDetailActivity.this)
                        .load(App.getBaseUrl() + data1.getImgUrl())
                        .into(im);

                titleTv.setText(data1.getTitle());
                contentTv.setText(data1.getContent());
                otherTv.setText("承办单位："+data1.getUndertaker()+
                        "\n提交时间："+data1.getCreateTime()+
                        "\n反馈处理状态:"+data1.getState()+
                        "\n处理结果:"+data1.getDetailResult());
            }
        });
    }

    @Override
    protected void initEvent() {

    }
}